

#ifdef CONFIG_IDF_TARGET
    #define IS_ESP_IDF_ENVIRONMENT 1   
#else
    #define IS_ESP_IDF_ENVIRONMENT 0   
#endif


if(DEFINED ESP_PLATFORM)
    set(include_dirs "")
    set(src_files "")
    #cwit_list
    list(APPEND include_dirs "./cwit_list")
    list(APPEND src_files "./cwit_list/cwit_list.c")

    #cwit_map
    list(APPEND include_dirs "./cwit_map")
    list(APPEND src_files "./cwit_map/cwit_map.c")

    #cwit_string
    list(APPEND include_dirs "./cwit_string")
    list(APPEND src_files "./cwit_string/cwit_string.c")

    #cwit_notify
    list(APPEND include_dirs "./cwit_notify")
    list(APPEND src_files "./cwit_notify/cwit_notify.c")

    idf_component_register(SRCS ${src_files} INCLUDE_DIRS ${include_dirs})
else()
    # cmake_minimum_required(VERSION 2.7.0)
    cmake_minimum_required(VERSION 2.7.0)
    project("cwit_c_libs")
    set(SRC)
    list(APPEND SRC)

    aux_source_directory(cwit_list SRC)
    include_directories(cwit_list)

    aux_source_directory(cwit_string SRC)
    include_directories(cwit_string)

    aux_source_directory(cwit_map SRC)
    include_directories(cwit_map)

    aux_source_directory(cwit_notify SRC)
    include_directories(cwit_notify)

    add_executable("cwit_list_test" "cwit_list_test.c" ${SRC} ${DRIVERLIB})
    add_executable("cwit_map_test" "cwit_map_test.c" ${SRC} ${DRIVERLIB})
    add_executable("cwit_notify_test" "cwit_notify_test.c" ${SRC} ${DRIVERLIB})
    add_library(cwit_c_libs.a STATIC  ${SRC})
    add_library(cwit_c_libs.dll SHARED  ${SRC})
endif()
